	
	//初始化
	$(document).ready(function(){
	    $('#formLogin').click(function(e)
	    {
	    	login();
	        e.preventDefault();
	    });
	});
    		
    		
	document.onkeydown=function(event)
	{
		var e = event || window.event || arguments.callee.caller.arguments[0];
		
		if(e && e.keyCode==13)
		{
			login();
		}
	}
    		
    		
	var login = function()
	{
		var loginName = document.getElementById("loginName").value;
    	var loginPass = document.getElementById("loginPass").value;
    	
    	if(loginName == ""){
    		layer.tips('登录名称不能为空', '#loginName');
  		  	return;
    	}
    	
    	if(loginPass == ""){
    		layer.tips('登录密码不能为空', '#loginPass');
  		  	return;
    	}
    	
        var formData = {};
        formData.loginName = loginName;
        formData.loginPass = $.md5(loginPass);
        
        $.post('${basePath}/user/login?secretKey=56i75pmu5o6n6IKh6ZuG5Zui',formData,function(datas){
        	
        	if(datas.flag == 100100)
        	{
        		window.location.href='${basePath}/user/homepage';
        		return;
        	if(datas.flag == "100200")
        	{
        		 alert(JSON.stringify(datas));
        		return;
        	}
        	layer.msg(datas.message);
        }
	  });
	}
	
	
	
	